package com.itfreer.gis.locus.data.entity;

import java.io.Serializable;
import java.util.Date;
import com.itfreer.form.api.entity.EntityBase;
import com.itfreer.form.api.reflect.DictionaryField;
import com.itfreer.utils.file.FileMeta;
import com.itfreer.utils.json.JsonUtils;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;

/**
 * 巡护事件
 */
@Entity(name = "gis_locus_event")
public class LocusEventEntity extends EntityBase implements Serializable {
	private static final long serialVersionUID = 1L;

	@Column(name = "gid", length = 50)
	private Integer gid;

	/**
	 * Id
	 */
	@Id
	@Column(name = "id", length = 50)
	private String id;

	/**
	 * 所有者
	 */
	@Column(name = "s_owerid", length = 50, nullable = true)
	private String owerid;

	/**
	 * 轨迹ID
	 */
	@Column(name = "s_locusid", length = 50, nullable = true)
	private String locusid;

	/**
	 * 所有者
	 */
	@Column(name = "s_owername", length = 50, nullable = true)
	private String owername;

	@Column(name = "sheng", nullable = true, length = 50)
	@DictionaryField(dictionaryName = "p_administrative", toFieldName = "shengName")
	private String sheng;

	@Transient
	private String shengName;

	@Column(name = "shi", nullable = true, length = 50)
	@DictionaryField(dictionaryName = "p_administrative", toFieldName = "shiName")
	private String shi;

	@Transient
	private String shiName;

	/**
	 * 县
	 */
	@Column(name = "xian", length = 50, nullable = true)
	@DictionaryField(dictionaryName = "p_administrative", toFieldName = "xianName")
	private String xian;

	@Transient
	private String xianName;

	/**
	 * 乡
	 */
	@Column(name = "xiang", length = 50, nullable = true)
	@DictionaryField(dictionaryName = "p_administrative", toFieldName = "xiangName")
	private String xiang;

	@Transient
	private String xiangName;

	/**
	 * 村
	 */
	@Column(name = "cun", length = 50, nullable = true)
	@DictionaryField(dictionaryName = "p_administrative", toFieldName = "cunName")
	private String cun;

	@Transient
	private String cunName;

	/**
	 * 事件名称
	 */
	@Column(name = "s_name", length = 50, nullable = true)
	@DictionaryField(dictionaryName = "LOCUS_TYPE", toFieldName = "nameName")
	private String name;

	@Column(name = "s_namename", length = 50, nullable = true)
	private String nameName;

	/**
	 * 内容是否为音频
	 */
	@Column(name = "b_audio", nullable = true)
	private Boolean isAudio;

	/**
	 * 内容说明
	 */
	@Column(name = "s_content", columnDefinition = "text", nullable = true)
	private String content;

	/**
	 * 音频内容说明
	 */
	@Column(name = "s_audio", columnDefinition = "text", nullable = true)
	private String audio;

	/**
	 * 事件类型 字符串 事件类型（1山火、2盗伐、3侵占、4病虫害、5其他）
	 */
	@Column(name = "s_type", length = 10, nullable = true)
	@DictionaryField(dictionaryName = "LOCUS_TYPE", toFieldName = "typeName")
	private String type;

	@Transient
	private String typeName;

	/**
	 * 事件状态 字符串 状态（1待处理，2进行中，3误报，4已处理）
	 */
	@Column(name = "s_status", length = 10, nullable = true)
	@DictionaryField(dictionaryName = "LOCUS_STATUS", toFieldName = "statusName")
	private String status;

	@Transient
	private String statusName;

	/**
	 * 附件
	 */
	@Column(name = "u_image", columnDefinition = "text", nullable = true)
	private String image;

	/**
	 * 描述
	 */
	@Column(name = "describe", length = 50, nullable = true)
	private String describe;

	/**
	 * 纬度
	 */
	@Column(name = "d_latitude", nullable = true)
	private Double latitude;

	/**
	 * 经度
	 */
	@Column(name = "d_longitude", nullable = true)
	private Double longitude;

	/**
	 * 事件时间
	 */
	@Column(name = "event_time", length = 10, nullable = true)
	private Date eventtime;

	@Column(name = "handle_content", length = 10, nullable = true)
	private String handleContent;

	@Transient
	private String nowTime;


	@Transient
	private String secretKey;

	/**
	 * 创建时间
	 */
	@Column(name = "d_createtime", length = 10, nullable = true)
	private Date createtime;

	/**
	 * 更新时间
	 */
	@Column(name = "d_updatetime", length = 10, nullable = true)
	private Date updatetime;

	/**
	 * 逻辑删除
	 */
	@Column(name = "s_logicaldelete", length = 10, nullable = true)
	private String logicalDelete;

	/**
	 * 租户ID
	 */
	@Column(name = "s_tenantID", length = 50, nullable = true)
	private String tenantID;

	/**
	 * 租户名称
	 */
	@Column(name = "s_tenantName", length = 50, nullable = true)
	private String tenantName;

	@Column(name = "taskid", length = 50, nullable = true)
	private String taskid;
	
	@Column(name = "s_address", length = 100, nullable = true)
	private String s_address;
	
	@Column(name = "s_adcode", length = 100, nullable = true)
	private String s_adcode;
	
	@Column(name = "s_location", length = 100, nullable = true)
	private String s_location;

	@Column(name = "s_zones", nullable = true)
	private String zones;

	public String[] getZones() {
		return this.getStringArray(zones);
	}

	public void setZones(String[] zones) {
		this.zones = this.getArrayString(zones);
	}

	public Integer getGid() {
		return gid;
	}

	public void setGid(Integer gid) {
		this.gid = gid;
	}

	@Override
	public String getId() {
		return id;
	}

	@Override
	public void setId(String id) {
		this.id = id;
	}

	public String getOwerid() {
		return owerid;
	}

	public void setOwerid(String owerid) {
		this.owerid = owerid;
	}

	public String getLocusid() {
		return locusid;
	}

	public void setLocusid(String locusid) {
		this.locusid = locusid;
	}

	public String getOwername() {
		return owername;
	}

	public void setOwername(String owername) {
		this.owername = owername;
	}

	public String getSheng() {
		return sheng;
	}

	public void setSheng(String sheng) {
		this.sheng = sheng;
	}

	@Transient
	public String getShengName() {
		return shengName;
	}

	public void setShengName(String shengName) {
		this.shengName = shengName;
	}

	public String getShi() {
		return shi;
	}

	public void setShi(String shi) {
		this.shi = shi;
	}

	@Transient
	public String getShiName() {
		return shiName;
	}

	public void setShiName(String shiName) {
		this.shiName = shiName;
	}

	public String getXian() {
		return xian;
	}

	public void setXian(String xian) {
		this.xian = xian;
	}

	public String getXiang() {
		return xiang;
	}

	public void setXiang(String xiang) {
		this.xiang = xiang;
	}

	public String getCun() {
		return cun;
	}

	public void setCun(String cun) {
		this.cun = cun;
	}

	@Transient
	public String getXianName() {
		return xianName;
	}

	public void setXianName(String xianName) {
		this.xianName = xianName;
	}

	@Transient
	public String getXiangName() {
		return xiangName;
	}

	public void setXiangName(String xiangName) {
		this.xiangName = xiangName;
	}

	@Transient
	public String getCunName() {
		return cunName;
	}

	public void setCunName(String cunName) {
		this.cunName = cunName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNameName() {
		return nameName;
	}

	public void setNameName(String nameName) {
		this.nameName = nameName;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Boolean getIsAudio() {
		return isAudio;
	}

	public void setIsAudio(Boolean isAudio) {
		this.isAudio = isAudio;
	}

	public String getAudio() {
		return audio;
	}

	public void setAudio(String audio) {
		this.audio = audio;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getStatusName() {
		return statusName;
	}

	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}

	public Date getCreatetime() {
		return createtime;
	}

	public Date getUpdatetime() {
		return updatetime;
	}

	/**
	 * 头像
	 */
	public FileMeta[] getImage() {
		return getFileArray(image);
	}

	/**
	 * 头像
	 */
	public void setImage(FileMeta[] uImages) {
		this.image = getFileString(uImages);
	}

	public String getDescribe() {
		return describe;
	}

	public void setDescribe(String describe) {
		this.describe = describe;
	}

	public Double getLatitude() {
		return latitude;
	}

	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}

	public Double getLongitude() {
		return longitude;
	}

	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}

	public Date getEventtime() {
		return eventtime;
	}

	public void setEventtime(Date eventtime) {
		this.eventtime = eventtime;
	}

	/**
	 * 设置创建时间值
	 */
	public void setCreatetime(Date time) {
		this.createtime = time;
	}

	/**
	 * 设置创建人值
	 */
	public void setCreateUserID(String userID) {
		this.owerid = userID;
	}

	/**
	 * 设置创建人值
	 */
	public void setCreateUserName(String userName) {
		this.owername = userName;
	}

	/**
	 * 设置更新时间值
	 */
	public void setUpdatetime(Date time) {
		this.updatetime = time;
	}

	/**
	 * 逻辑删除
	 *
	 * @return
	 */
	public String getLogicalDelete() {
		return logicalDelete;
	}

	/**
	 * 逻辑删除
	 *
	 * @return
	 */
	public void setLogicalDelete(String logicalDelete) {
		this.logicalDelete = logicalDelete;
	}

	/**
	 * 租户ID
	 */
	public String getTenantID() {
		return tenantID;
	}

	/**
	 * 租户ID
	 */
	public void setTenantID(String tenantID) {
		this.tenantID = tenantID;
	}

	/**
	 * 租户名称
	 */
	public String getTenantName() {
		return tenantName;
	}

	/**
	 * 租户名称
	 */
	public void setTenantName(String tenantName) {
		this.tenantName = tenantName;
	}

	public String getNowTime() {
		return nowTime;
	}

	public void setNowTime(String nowTime) {
		this.nowTime = nowTime;
	}

	public String getSecretKey() {
		return secretKey;
	}

	public void setSecretKey(String secretKey) {
		this.secretKey = secretKey;
	}

	public String getHandleContent() {
		return handleContent;
	}

	public void setHandleContent(String handleContent) {
		this.handleContent = handleContent;
	}

	public String getTaskid() {
		return taskid;
	}

	public void setTaskid(String taskid) {
		this.taskid = taskid;
	}

	public String getS_address() {
		return s_address;
	}

	public void setS_address(String s_address) {
		this.s_address = s_address;
	}

	public String getS_adcode() {
		return s_adcode;
	}

	public void setS_adcode(String s_adcode) {
		this.s_adcode = s_adcode;
	}

	public String getS_location() {
		return s_location;
	}

	public void setS_location(String s_location) {
		this.s_location = s_location;
	}

	@Override
	protected String getFileString(FileMeta[] items) {
		if (items == null) {
			return null;
		} else {
			return JsonUtils.toJSONString(items);
		}
	}
}
